<template>
	<view class="content ">
		 <view class="iconfont icon-fanhui5 white size60 backImg" @click="$back()"></view>
		<view class="box d-flex flexac">
			<view class="row f-column  a-center">
				<view class="white size32">
					您已邀请 <text class="size42 bold m-left6 m-right6">{{shareList.length}}</text> 位好友
				</view>
				<view class="miexi white flexac size36 m-top20"  
				      @click="toUrl('/share/copCode/detailed')">邀请明细</view>
				<view class="btnYin white flexac size36 m-top60" @click="toUrl('/share/copCode/sharCode')">分享二维码</view>
				<view class="btnYin white flexac size36 m-top30" 
				     @click="toUrl('/share/copCode/copCode')">复制邀请码</view>
			</view>
		</view>
		
		<view class="addbox auto m-top30 flexac">
			<input type="text"  
			      class="inputTxt text-center  flexac white size28" 
				  placeholder="输入好友邀请码"
				  :disabled="disabled"
				  v-model="code">
			<view class="config flexac size30 black m-left20" @click="binding">绑定</view>
		</view>
		
		
		
	</view>
	
</template>

<script>
	import qrcode from '../../components/tki-qrcode/tki-qrcode.vue'
	export default {
		data() {
			return {
				code:'',
				shareList:[],
				info:'',
				showCode:false,
				disabled:true
			};
		},
		components: {
			qrcode
		},
		onLoad() {
	
			this.team();
			this.share();
		},
		methods: {
			share(){
				this.$http.get('user/share').then(res=>{
					if(res.code != 1) return this.$Toast(res.msg);
					this.info = res.data;
					if(!res.data.upuuid) return; 
					this.code = res.data.upuuid;
					this.disabled = false;
				})
			},
			team(){
				this.$http.get('/user/team').then(res=>{
					if(res.code != 1) return this.$Toast(res.msg);
					this.shareList = res.data;
				})
			},
			binding(){
				if(!this.code) return this.$Toast('请输入邀请码！');
				this.$http.post('/User/teamBind',{uuid:this.code}).then(res=>{
					if(res.code != 1) return this.$Toast(res.msg);
					this.$Toast(res.msg,2)
				})
			},
			
			

		},
		
		
		filters:{
			is_authTxt(val){
				return val == 0?'未认证':'已认证'
			}
		}
	};
</script>
<style>
	page{
		background: #01032a;
	}
</style>
<style scoped lang="scss">
	
	.content{
		width: 100%;
		background-image: url(@/static/imgs/shareBg.png);
		background-repeat: no-repeat;
		background-size: cover;
		padding-top: 400rpx;
	}
	.box{
		width:670rpx;
		height: 550rpx;
		margin:0 auto;
		background-image: url(@/static/imgs/shareBor.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;
	}
	.miexi{
		width:290rpx;
		height: 76rpx;
		background-image: url(@/static/imgs/btn1.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;
	}
	.btnYin{
		width:403rpx;
		height: 86rpx;
		background-image: url(@/static/imgs/btn2.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;
	}
	.addbox{
		width:660rpx;
		height: 160rpx;
		background-image: url(@/static/imgs/shareBor2.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;
	}
	.inputTxt{
		width:310rpx;
		height: 70rpx;
		border:1px solid #ffffff;
		border-radius: 35rpx;
	}
	.config{
		width:150rpx;
		height: 62rpx;
		background-image: url(@/static/imgs/btn04.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;
	}
	.codeImg{
		width:690rpx;
	}
	.SaveImg{
		width:257rpx;
		height: 60rpx;
		border-radius: 20rpx;
		background-color: #7f2e8d;
	}
</style>
